'********************************
'********QUOTES SCRIPT PLUGIN**********
'This cheats on the scripted typing challenge game.  (Where it says "Type this: "...)
'Should handle many variations, adjust it to your own personal needs
'USAGE:  
'   -Will Autorespond to the keyword type
'   .cheat <on/off>  enables/disables the cheat system

Const ScriptVer="ChallengeCheat V1.1 by The-FooL"
enabled=false
delay=false

'************
'//This Sub Is called When the script File is loaded
'**********
Sub Event_Load()
	'ssc.AddChat vbgreen, "TestScript Loaded!"
End Sub



'************
'//Bot has logged onto Battle.net  SCGateway is the
'    SCGateway - "useast", "uswest", "asia", etc
'    WCGateway - "Azeroth", "Northrend", etc.
'    Both of the above are passed regardless of product
'****************
Sub Event_LoggedOn(Username, Product, SCGateway, WCGateway)
	'ssc.addChat "(TestScript)Logged Onto " & SCGateway & "/" & WCGateway
End Sub


Sub Event_Usertalk(Username, Flags, Message, Ping)
	if not enabled then exit sub
	If Instr(lcase(Message),"type")>0 Then
		'ssc.addchat "Cheating"
		dim ans
		if Instr(Message,"[")>0 THEN
			ans=Mid(Message,Instr(Message,"["))
		ELSEIF Instr(Message,"<-")>0 THEN
			ssc.addchat "?"
			ans=Split(Message,"<-")(0)
		ELSEIF Instr(Message,"->")>0 THEN
			ans=Split(Message,"->",1)(1)
		ELSEIF Instr(Message,"(")>0 THEN
			ans=Mid(Message,Instr(Message,"("))
		ELSEIF Instr(Message,":")>0 THEN
			ans=Mid(Message,Instr(Message,":"))
		ELSE
			s=Split(Message,"type")
			ans=s(0)
			if ubound(s)>0 then ans=s(1)
		ENd IF
		ans=trim(replace(ans,"(O)",""))
		ans=trim(replace(ans,":",""))
		ans=trim(replace(ans,"]",""))
		ans=trim(replace(ans,")",""))
		ans=trim(replace(ans,"(",""))
		ans=trim(replace(ans,"[",""))
		ans=trim(replace(ans,"[",""))
		ans=trim(replace(ans,".",""))
		ans=trim(replace(ans,"'",""))
		ans=trim(replace(ans,"Please",""))
		ans=trim(replace(ans,"please.",""))
		ans=trim(replace(ans,"please",""))
		ans=trim(replace(ans,"BUT NOT THIS",""))
		if left(ans,1)=";" then ans=replace(ans,";","")
		if left(ans,1)="/" then ans=replace(ans,"/","")
		if delay then sleep 500
		ssc.addq ans
	End If
End Sub


'///My semi-Complex On Join Sub
'    Parsed Statstring - Contains the parsed statstring of the user
'    OrigStatString - Contains the unmodifed statstring of the user
'    Clan - WC Clan(If applicable)
'    GreetUser -   If false, then that means the user has already been
'    marked as banned(ban has been sent to que).  You should take advantage
'    Of this to not waste time with the user.  
'    
' //This is a Function(Default return value is always false).  If you set the return
'  value to TRUE ( Event_UserJoins=TRUE) then the greetUser variable will be set
'  to false(bot greets will not be sent, and user will not be checked for 
'  mail/lastseen).
' //Because I have already retrieved Access and Safelisted status, I have passed those
'    as well
'    
'**************
Function Event_UserJoins(Username, Flags, ParsedStatString, OrigStatString, Product, Clan, Ping, Access, safeListed, GreetUser)


End Function


Sub Event_ServerInfo(Message) 


End Sub


Sub Event_ServerError(Message)

End Sub



Sub Event_UserEmote(Username, Flags, Message)

End Sub


Sub Event_WhisperFromUser(Username, Flags, Message)

End Sub


Sub Event_WhisperToUser(Username, Flags, Message)

End Sub


Sub Event_UserLeaves(Username, Flags)

End Sub

Sub Event_FlagUpdate(Username, NewFlags, Ping, Message)

End Sub

Sub Event_UserInChannel(Username, Flags, Message, Ping, Product, OrigStatString)

End Sub

Sub Event_ChannelJoin(ChannelName) ' Bot joins a different Channel
	
End Sub


Sub scTimer_Timer() ' fires when the timer goes off

'//Timer Settings can be modifed with the added ScriptTimer Object
'//ScriptTimer.Enabled=True, ScriptTimer.Interval=1000, etc

End Sub


'************
'//Fires when enter is pressed in the send box
'    ''This is a function.  By default the return value is false.
'      However, if you set the return value to TRUE(Event_PressedEnter=True)
'      Then the text will not be processed by the bot as normal
Function Event_PressedEnter(Text)
	if text="/bob" then Event_PressedEnter=True
End Function

'************
'//FooLOps Command Processor
'    I added a seperate sub for a command processor, called directly by my command 
'    processor.  This sub is called only after triggers have been parsed, and
'    multiple commands have been split.  The Ops Commands(Bans, unbans, or whatever I
'    have in my ops commands sub) have precedence over this.  If they are parsed, 
'    then this sub will never be called.
'
'///Here is how you parse/return the command.  "Command" contains the first word, 
'   the actual command(no trigger).  Rest is the rest of the command
'  (whatever follows, if anything).
'   Set the return value with Event_ParseCommand="Return Message"
'   If the return message is blank, then the bot will consider the command unparsed
'   and continue to search through the rest of the commands list
'   If the return message is a single space ' ', then the bot will consider the command
'   parsed but will not return anything to the que or bot window.
'   Any real return message will either be added directly to the que(you can use 
'   vbCrLfs for multiple lines), or send to the bot window(depending on where the
'   command was called from.
'   All script command processors are processed simultaneosly, so that they will not interfere with eachother.

' It is also important to note that in addition to this, Event_Usertalk or Event_WhisperFromUser can also be called.


Function Event_ParseCommand(Command, Rest, Username, Access, Inbot)
select case command
	case "scriptver"
	   if access<20 then exit function
	   event_parsecommand =ScriptVer
        case "aboutscript"
	If access<50 then exit function
	   Event_ParseCommand="ChallengeCheat:  Cheats on the 'Type This sentence' game"
	case "cheat"
	if access<100 then exit function
	select case rest
		case "on"
		enabled=true
		event_parsecommand="ChallengeCheat Enabled"
		case "off"
		enabled=false
		event_parsecommand="ChallengeCheat Disabled"
		case "status"
		event_parsecommand="ChallengeCheat Disabled"
		If enabled then event_parsecommand="ChallengeCheat Enabled"
	end select
	case else
	'put as many cases as you need for this scripts commands

end select

End Function

'///When The Script File is Unloaded(Bot Close)
Sub Event_Close()
	
End Sub

